|
Bands in FastReport Bands are used for logical object grouping. Thus, when placing an object to a band, such as "Page Header", we inform FastReport that the given object must be displayed on the top of each page of a finished report. In the same way, the "Page Footer" band is displayed at the bottom of each page together with all the objects allocated in it. Let us demonstrate it with an example. Let us create a report, which contains the "Hello!" inscription on the top of the page, a current date to the right of it, and a page number at the foot of the page (to the right). Open the FastReport designer and click the "New report" button in the toolbar. You will see a report template, which already contains three bands: "Report title", "Master data", and "Page footer". Let us remove the "Master data" band for a while (to do that, click either on any free space inside the band, or on its header, and then remove it by pressing the "delete" key or using the corresponding section in the contextual menu). Now let us add a new band ("Page header"). To perform this, click the "Add band" button and select "Page header" in the dropped list. We see that a new band is added to the page. At the same time, the existing bands were moved down. FastReport designer automatically allocates bands on the page, and, as a result, header-bands are allocated on the top, data-bands are in the middle, and footer-bands are at the bottom. Now let us allocate objects. Allocate "System text" object in the "Page header" band and select "System variable" in its editor "[DATE]" (you should remember that the date can be displayed with the help of a usual "Text" object by typing "[DATE]" in its editor). We allocate "Text" object, which will contain the "Hello!" text in the "Report title" band. Moreover, as you can see, the required object, which displays page number, is already allocated in the "Pagefooter" band.
If running the report, you would see that the objects in the finished report are allocated in the way we need.
Thus, bands are responsible for object allocation in required places. Depending on band type, we can allocate an object either at the top or at the bottom of the page, on the first page, or on the last one. The basic bands, which we would need in most reports, work in the following way: - "Page header" band is displayed at the very top of each page; |